package com.javaspeak.designpatterns.go4.behavioural.observer;

/**
 * Observers are interested in receiving ObservableEvents when a specific
 * happening occurs in the Observable (ApplicationObserver).
 *
 * @author John Dickerson
 */
public class ObserverImpl implements Observer {

    private String observerName;

    /**
     * Constructor
     *
     * @param observerName
     */
    public ObserverImpl( String observerName ){

        this.observerName = observerName;
    }


    /* (non-Javadoc)
     * @see com.javaspeak.designpatterns.go4.behavioural.observer.
     *      Observer#receiveObservableEvent(com.javaspeak.designpatterns.go4.
     *          behavioural.observer.ObservableEvent)
     */
    @Override
    public void receiveObservableEvent( ObservableEvent observableEvent ) {

        System.out.println(
            observerName + " received ObservableEvent with message : " +
                observableEvent.getMessage() );
    }
}
